#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include<QkeyEvent>

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

//1.按键处理

typedef enum Direct{
    DIR_LEFT,
    DIR_RIGHT,
    DIR_UP,
    DIR_DOWN
}dir_t;

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

protected:
    //按键处理
    void keyPressEvent(QKeyEvent *event) ;

private:
    Ui::Widget *ui;
    int moveFlag=DIR_UP;
    bool gameStart=false;
};
#endif // WIDGET_H
